package com.jjh.util;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

/**
 * 键盘监听工具类
 */
public class KeywordListener implements KeyListener {

    @Override
    public void keyTyped(KeyEvent e) {

    }

    @Override
    public void keyPressed(KeyEvent e) {
        int code = e.getKeyCode();
       if(code==38){
           System.out.println("按了上键");
       } else if (code==40) {
           System.out.println("按了下键");
        }
        //System.out.println(code);
    }

    @Override
    public void keyReleased(KeyEvent e) {

    }
}